package com.authine.cloudpivot.engine.enums.type;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum DataPermissionType {

    ALL("所有数据", 1),
    MY_DEPARTMENT("本部门数据", 2),
    ONLY_MYSELF("仅自己", 3),
    CUSTOM("自定义", 4),
    ROLE_MANAGE_SCOPE("角色管理范围", 5),
    CURRNET_HANDLER("当前处理人", 6),
    APPROVED_HANDLER("历史处理人", 7);

    public static final String DESCRIPTION = "1: 所有数据， 2：本部门数据，3：仅自己，4：自定义 ";
    private final String name;
    private final int index;

    private DataPermissionType(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public static String getName(int index) {
        DataPermissionType[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            DataPermissionType status = var1[var3];
            if (status.getIndex() == index) {
                return status.name;
            }
        }

        return null;
    }

    @JsonCreator
    public static DataPermissionType get(int index) {
        DataPermissionType[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            DataPermissionType status = var1[var3];
            if (status.getIndex() == index) {
                return status;
            }
        }

        return null;
    }

    public String getName() {
        return this.name;
    }

    @JsonValue
    public int getIndex() {
        return this.index;
    }

}
